<?php
namespace App\Common\Constants;

use App\Enums\{EnumTrait, DefaultCase, Localization};

/** 通用常量信息 */
enum CommonConst: string {
    use EnumTrait;

    #[Localization(label:'UTF-8 字符集')]
    case UTF8               = "UTF-8";

    #[Localization(label:'GBK 字符集')]
    case GBK                = "GBK";

    #[Localization(label:'www主域')]
    case WWW                = "www.";

    #[Localization(label:'http请求')]
    case HTTP               = "http://";

    #[Localization(label:'https请求')]
    case HTTPS              = "https://";

    #[Localization(label:'通用成功标识')]
    case SUCCESS            = "0";

    #[Localization(label:'通用失败标识')]
    case FAIL               = "1";

    #[Localization(label:'登录成功')]
    case LOGIN_SUCCESS      = "Success";

    #[Localization(label:'注销')]
    case LOGOUT             = "Logout";

    #[Localization(label:'注册')]
    case REGISTER           = "Register";

    #[Localization(label:'登录失败')]
    case LOGIN_FAIL         = "Error";
 
    #[Localization(label:'验证码有效期（分钟）')]
    case CAPTCHA_EXPIRATION = '2';

    #[Localization(label:'令牌')]
    case TOKEN              = "token";

    #[Localization(label:'令牌前缀')]
    case TOKEN_PREFIX       = "Bearer ";

    #[Localization(label:'令牌前缀')]
    case LOGIN_USER_KEY     = "login_user_key";

    #[Localization(label:'用户ID')]
    case JWT_USERID         = "userid";

    #[Localization(label:'用户名称')]
    case JWT_USERNAME       = 'sub';

    #[Localization(label:'用户头像')]
    case JWT_AVATAR         = "avatar";

    #[Localization(label:'创建时间')]
    case JWT_CREATED        = "created";

    #[Localization(label:'用户权限')]
    case JWT_AUTHORITIES        = "authorities";

    #[Localization(label:'资源映射路径 前缀')]
    case RESOURCE_PREFIX        = "/profile";

    #[Localization(label:'RMI 远程方法调用')]
    case LOOKUP_RMI             = "rmi:";

    #[Localization(label:'LDAP 远程方法调用')]
    case LOOKUP_LDAP            = "ldap:";

    #[Localization(label:'LDAPS 远程方法调用')]
    case LOOKUP_LDAPS           = "ldaps:";

    /** 定时任务白名单配置（仅允许访问的包名，如其他需要可以自行添加） */
    const JOB_WHITELIST_STR     = ["com.ruoyi"];

    /** 定时任务违规的字符 */
    const JOB_ERROR_STR         = ["java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
            "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.framework.config"];

}
